<!--
 * @Author: your name
 * @Date: 2020-04-13 11:48:52
 * @LastEditTime: 2020-07-23 16:41:46
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \467\huosdk_web_js_css\vue_wap\src\App.vue
--> 
<template>
  <div id="app">
    <router-view/>

    <!-- 礼包码 -->
    <GiftCode v-if="giftCodeIsShow"/>

    <app-confirm v-if="$store.state.confirm.visible"
                 :options="$store.state.confirm.option">
    </app-confirm>

    <img class="wx-guide" src="@/assets/img/wxzy.png" @click="hideWxGuide" v-if="wxGuideIsShow">

    <!-- 下方提示 -->
    <transition name="fade">
      <div class="toast" v-if="toastMsg">
        <span class="toast__msg">{{toastMsg}}</span>
      </div>
    </transition>
  </div>
</template>

<script>
/*  function getIsWxClient() {
    var ua = navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == "micromessenger") {
      return true;
    }
    return false;
  };
  let isWxClient=getIsWxClient()
  if (isWxClient) {
    alert(1)
  }*/
  import {mapGetters} from 'vuex'
  import GiftCode from '@/components/gift/Code'
  import appConfirm from '@/components/common/AppConfirm.vue'

  export default {
    name: 'app',
    components: {
      GiftCode,
      appConfirm
    },
    computed: {
      ...mapGetters([
        'giftCodeIsShow',
        'wxGuideIsShow',
        'toastMsg'
      ])
    },

    created() {
      this.$store.dispatch('getPlayIndex')
      this.$store.dispatch('getUserinfo')
    },
    methods: {
      hideWxGuide() {
        this.$store.commit('SET_POP_STATUS', {
          type: 'wxGuide',
          show: false
        })
      },
    },
    watch: {
      '$route'(to) {
        // this.$store.dispatch('getPlayIndex')
        this.$store.dispatch('getUserinfo')
      }
    }
  }
</script>

<style lang="scss">
  @import './assets/css/index.scss';

  #app {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  .wx-guide {
    height: 100%;
    left: 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 99999;
  }

  .huosdk_tips {
    z-index: 100 !important;
  }

  .pop_body {
    z-index: 101 !important;
  }
</style>
